package cn.jiyun.jobs;

import cn.jiyun.utils.QiniuUtils;
import org.springframework.beans.factory.annotation.Autowired;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

import java.util.Set;

public class ClearImgJob {

    @Autowired
    private JedisPool jedisPool;

    public void clearImg(){
        System.out.println("清理图片开始...");
        Jedis jedis = jedisPool.getResource();
        Set<String> imgList = jedis.sdiff("setA", "setB");
        for (String img : imgList) {
            QiniuUtils.deleteFileFromQiniu(img);
        }


        System.out.println("清理图片结束...");
    }
}
